
<template name='verify_order'>
<!-- 用户的账单查询	 -->
	<view class="box-infos font12   relative">
		
		
		<!-- 列表区 -->
		<view class="content-box " >
			<view class="boxsss40" >
				<!-- 操作区 -->
				<view class="top-but search-box">
					<view class="caogao-but-box">
						<text selectable="true"  class="tipss">对某用户的历史账单进行对账</text>
						<view @click="$common.noMultipleClicks('fun_dz_list',fun_dz_list,true)" 
						class="rightButttom" >
							<img src="../../static/img/search.png" class="ico"></img>
							刷新
						</view>
						
						<button
						@click="$my_excel.verify(duizhang.resData.list,false)"
						class="nowBut color7 font12"
						>
							导出
						</button>
						
					</view>
				</view>
				<!-- end -->
				<table v-if="duizhang.resData.list &&  duizhang.resData.list.length>0">
					<!-- 表头 -->
					<thead>
						<tr >
							<th  class="centers " style="min-width: 20px;">
								序
							</th>
							
							<th  >
								订单号
							</th>
								
							<th  class="centers ">
								时间
							</th>
							<th  class=" ">
								余额
							</th>
							<th  class=" ">
								金额
							</th>
							<th  class=" ">
								结余
							</th>
							<th  class="centers ">
								类型
							</th>
							<th  class=" ">
								操作者
							</th>
							<th  class=" ">
								备注
							</th>
							<th  class="centers ">
								操作
							</th>
						</tr>
					</thead>
					<tbody>
						<!-- 内容 -->
						<tr @click="TabcheckedIndex=index,orderOnClick(item)" 
						:key="index"
						v-for="(item,index) in duizhang.resData.list" 
						:class="TabcheckedIndex == index ? 'goods-list-select':''"
						:style="(item.status==1||item.status==6) ?'color: #ff2626;':'color: #106501'"
						>
							<td  class="centers ">
								{{index+1}}
							</td>
							<td>
								<view class="centers  font12 relative flex">
									<view>{{item.id}}</view>
									<view class="back_data">
										<image src="/static/img/order_type.png" :title="$global.title.m29" class="ico" v-if="item.order_status==1"></image>
										<image src="/static/img/goods_back.png" :title="$global.title.m16" class="ico" v-if="item.back==0"></image>
										<image src="/static/img/goods_misk.png" :title="$global.title.m17" class="ico" v-if="item.goodsIsProfit"></image>
										<image src="/static/img/cz_record.png"  :title="$global.title.m39" class="ico"v-if="item.money_record==0" @click.stop="$refs.chongzhang_order.open(item.id)"></image>
										
										
										<image
										src="/static/img/jinggao.png" 
										title="当前单据含有修改批发价的记录" 
										class="ico" 
										v-if="item.moneyUpdateRecord"
										></image>
									</view>
								</view>
							</td>
							<td>
								{{item.date}}
							</td>
							<td   class="">
								￥{{item.money_n}}
							</td>
							<td   class="weight" >
								￥{{item.money}}
							</td>
							<td   class="weight">
								￥{{item.money_m}}
							</td>
							
							<td  class="centers " >
								{{item.order_type}}
							</td>
							<td  class=" ">
								{{item.uid_name}}
							</td>
							<td  class="centers alter">
								<descr :value="item.descr" :order_id="item.id"></descr>
							</td>
							<td  class="centers ">
								<view class="flex gap10">
									<button class="font12 color1"
									v-if="(item.status==1||item.status==6) && index==0" 
									@click.stop="$refs.chongzhang.open(item)"
									>修正</button>
									<button class="font12 color2 "
									v-if="(item.status==1||item.status==6) && index==0" 
									@click.stop="$req.deleteOeder(item.id)"
									>删除</button>
								</view>
							</td>
						</tr>
					</tbody>
				</table>
				<!-- 暂无数据 -->
				<empty v-if="duizhang.resData.list &&  duizhang.resData.list.length==0"></empty>
				<!-- end -->
			</view>
			
			<!-- 分页 -->
			<pages 
			:sum="duizhang.page.sum"
			:current="duizhang.page.nowPage"
			@updatePage="updatePage_duizhang"
			></pages>
			<!-- end -->
		</view>
		<!-- end -->
		
	
		<chongzhang ref="chongzhang" ></chongzhang>
		<cz_record ref="chongzhang_order"></cz_record>
	</view>

</template>

<script>
	import pages from "@/components/admin-components/pages.vue"
	import empty from "@/components/admin-components/empty.vue"
	import descr from "@/components/descr/descr.vue"
	import chongzhang from "@/components/chongzhang/chongzhang.vue"
	import cz_record from "@/components/chongzhang/record"
	export default{
		name:'verify_order',
		components: {
			empty,
			pages,
			descr,
			chongzhang,
			cz_record,
		},
		data(){
			return{
				PrintOrderData:{},//欲要打印的订单数据
				TabcheckedIndex:-1,//当前选中项
				order_info:{//弹出来的详细单据
					order:{},
					list:[],
					user:{},
				},
				duizhang:{
					page:{
						
						nowPage:1,//当前页数
						pageCount:1,//总页数
						maxCount:0,
						sum:0,
						pageCounts:15,
					},
					resData:{
						list:[]
					},
				}
			}
		},
		 // 此处定义传入的数据
		props: {
			OnPageUserId: '',//需要查账单的用户ID
		},
		created() {
			this.fun_dz_list(true)
		},
		methods:{
			/**
			 * 点击量某个账单
			 * 
			*/
			orderOnClick(item){
				//这个需要回调的方法
				this.$common.GetOrder(item.id,false,2)
				//this.$emit('OnClickOrderInfo',{order_id:order_id,user_id:user_id}) //(父组件中触发的事件名，要传的变量名)
			},
			/**
			 * 分页器回调
			 * 
			*/
			updatePage_duizhang(pageName,pageCount){
				this.duizhang.page.nowPage = pageName
				this.duizhang.page.pageCounts = pageCount
				this.fun_dz_list(false)
			},
			/**
			 * 对账-获取列表
			*/
			fun_dz_list(isUpdatePage=true,ReqExport=0){
				var that = this
				 
				if(!that.OnPageUserId){
					that.$common.toast("未有选择需要查看历史单的用户，请先选择后再试")
					return
				}
				that.duizhang.page.nowPage = isUpdatePage==true ? 1:that.duizhang.page.nowPage;
				that.duizhang.resData = {}
			
				that.$common.get_request(
					{
						type:'order_all_admin',
						types:1,//账号ID搜索
						accomplish:2,//已过账的
						uid: that.OnPageUserId,
						pages:that.duizhang.page.nowPage,//当前位于页数
						page_count:that.duizhang.page.pageCounts,//当前请求页的数量
						
					},
					(res)=>{
						that.duizhang.resData = res
						that.duizhang.page.pageCount  = res.pageCount
						that.duizhang.page.sum        = res.sum
						if(isUpdatePage == true){
							that.duizhang.page.nowPage  = 1
						}
						that.duizhang.page.maxCount   = res.maxCount
					}
				);
			},
		}
	}
</script>

<style>
</style>
